import { PoolManager } from "../Managers/PoolManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class AniFinishRecycle extends cc.Component {
    ani: cc.Animation = null;

    protected onEnable(): void {
        this.ani = this.node.getComponent(cc.Animation);
        this.ani.on('finished', this.Put, this);
        this.ani.play();
    }

    protected onDisable(): void {
        this.ani?.off('finished', this.Put, this);
    }

    Put() {
        PoolManager.PutNode(this.node);
    }

}
